package top.fzqblog.sysservice;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;

import static top.fzqblog.utils.Constants.TAG;

/**
 * Created by 抽离 on 2017/10/9 0009.
 */

public class BindServiceConnection implements ServiceConnection {
    
    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        Log.i(TAG, "onServiceConnected: ");
        BindService.MyBinder myBinder = (BindService.MyBinder) iBinder;//拿到binder实例
        BindService bindService = myBinder.getService();
        Log.i(TAG, "date: " + bindService.getDate());
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        Log.i(TAG, "onServiceDisconnected: ");
    }
}
